package com.cordershy;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.scheduling.annotation.EnableScheduling;

import javax.annotation.PostConstruct;


@SpringBootApplication
@EnableScheduling
@EnableCaching
@MapperScan(basePackages = "com.cordershy.mapper")
public class AccountApplication {
    @Autowired
    RedisTemplate redisTemplate;
    public static void main(String[] args) {
        SpringApplication.run(AccountApplication.class, args);
    }
    @PostConstruct
    public void iniRedis(){
        RedisSerializer serializer = redisTemplate.getStringSerializer();
        redisTemplate.setKeySerializer(serializer);
        redisTemplate.setHashKeySerializer(serializer);
    }
}




